package ru.susu.algebra.centralunits;



import java.math.BigInteger;

import org.apache.log4j.BasicConfigurator;

import ru.susu.algebra.centralunits.alternating.AlternatingGroupCentralUnitsSearcher;
import ru.susu.algebra.iterators.SimpleForIntegerIterator;
import ru.susu.algebra.properties.IOptionsSource;
import ru.susu.algebra.properties.IPropertySource;
import ru.susu.algebra.properties.MapPropertySource;

/**
 * @author akargapolov
 * @since: 15.07.2010
 */
public class CentralUnitsSearchExecutor
{
	public static void main(String[] args) throws Exception
	{
		BasicConfigurator.configure();

		BigInteger.valueOf(5).divide(BigInteger.valueOf(2));
		IPropertySource ps = new AlternatingUnitsOptionsSource().getProperties();
		new CentralUnitSearcher().run(ps);
	}

	private static class AlternatingUnitsOptionsSource implements IOptionsSource
	{
		public static final int START_NUMBER = 5;
		public static final int END_NUMBER = 25;

		@Override
		public IPropertySource getProperties()
		{
			IPropertySource ps = new MapPropertySource();
			ps.setValue(CentralUnitsOptions.NUMBERS_ITERATOR, new SimpleForIntegerIterator(START_NUMBER, END_NUMBER, 1));
			ps.setValue(CentralUnitsOptions.UNITS_SEARCHER_CLASS, AlternatingGroupCentralUnitsSearcher.class.getName());
			return ps;
		}
	}
}
